package com.bnlr.lrparking.widget.popcity;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.bnlr.lrparking.R;
import com.bnlr.lrparking.model.CarPlaceTypeMode;

import java.util.List;

/**
 * Created by tian on 2017/9/16.
 */

public class PopStallAdapter extends BaseQuickAdapter<CarPlaceTypeMode,BaseViewHolder>{
    private TextView tvname;
    private int selection = -1;
    public PopStallAdapter(@Nullable List<CarPlaceTypeMode> data) {
        super(R.layout.city_name_layout,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CarPlaceTypeMode item) {
        tvname = helper.getView(R.id.city_name);
        tvname.setText(item.getValue());
        if (selection == helper.getAdapterPosition()) {
            tvname.setBackgroundColor(mContext.getResources().getColor(R.color.bg));
            tvname.setTextColor(mContext.getResources().getColor(R.color.colorAccent));
        } else {
            tvname.setBackgroundColor(mContext.getResources().getColor(R.color.write));
            tvname.setTextColor(mContext.getResources().getColor(R.color.text_color));
        }

    }
    public void setPressPostion(int position) {
        this.selection = position;
    }

}
